package controller;

import gui.MainWindow;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	
	public static ArrayList<String[]> readSets() throws IOException{
			
			FileInputStream fis = new FileInputStream("sets.csv");
			BufferedReader reader = new BufferedReader(new InputStreamReader(fis, "UTF-8"));
			String data="";
			String[] dataItems = null;
			ArrayList<String[]> sets = new ArrayList<String[]>();
			//discard header
			reader.readLine();
			while(data != null){
				data = reader.readLine();
				if(data != null){
					dataItems = data.split(";");
					sets.add(dataItems);
				}
			}
			System.out.println(sets.size());
			return sets;
	}
	
	public static void main (String [] arg){
		try {
			ArrayList<String[]> sets = readSets();
			MainWindow mw = new MainWindow(sets);
			mw.setVisible(true);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
